
var basicTestCase = new Html5Test.TestCase({
	name: "what",
	frameFunc: function(load){
				   this.ctx.clearRect(0, 0, this.width, this.height);
				   if (load > this.maxLoad) {
					   alert("Overload!");
				   }
	for(var i=0;i<load;i++)	
	{
	this.vx[i]+=this.ax[i]/50;
	this.vy[i]+=this.ay[i]/50;
	if(this.ax[i]==0 & this.ay[i]==0){
		this.vx[i]=this.vx[i]/1.05;
		this.vy[i]=this.vy[i]/1.05;
	}
	this.posX[i]+=this.vx[i];
	this.posY[i]+=this.vy[i];
	//var color=100;
	var color=Math.abs(Math.floor(this.vx[i]*20));//*20;
	this.r[i]=color;
	this.g[i]=0;
	this.b[i]=255-color;
	this.ax[i]=0;
	this.ay[i]=0;
	//var style="rgb("+color+","+0+","+(255-color)+")";
}
for(var i=0;i<load;i++){
	for(var j=0;j<load;j++){
		if(j!=i){
		var tmpx=this.posX[j]-this.posX[i];
		var tmpy=this.posY[j]-this.posY[i];
		var r=Math.sqrt(tmpx*tmpx+tmpy*tmpy);
		if(r>50){
			this.ax[i]+=0.001*tmpx/(100+r)*Math.sqrt(r);
			this.ay[i]+=0.001*tmpy/(100+r)*Math.sqrt(r);
		}
		else{
			this.ax[i]-=1*tmpx/(100+r)*Math.sqrt(r);
			this.ay[i]-=1*tmpy/(100+r)*Math.sqrt(r);
		}
		}
	}
}
for (var i = 0; i < load; i++) {
	this.ctx.fillStyle = "rgba(" + this.r[i] + "," + this.g[i] + "," + this.b[i] + "," + this.alpha[i] + ")";
	//this.ctx.fillRect(this.posX[i], this.posY[i], 40, 40);
	this.ctx.beginPath();
	this.ctx.arc(this.posX[i], this.posY[i],10,0,Math.PI*2,true);
	this.ctx.fill();
	//this.ctx.strokeRect(this.posX[i], this.posY[i], 40, 40);
}
}
});

basicTestCase.init = function(conf) {
	this.ctx = conf.ctx;
	this.width = conf.width;
	this.height = conf.height;
	this.checkFrequency = 15;
	this.maxLoad = 10000;
	this.posX = [];
	this.posY = [];
	this.r = [];
	this.g = [];
	this.b = [];
	this.alpha = [];
	this.ax=[];
	this.ay=[];
	this.vx=[];
	this.vy=[];


	var beginx;
	var beginy;
	for(var i=1;i<30;i++){
		beginx=400-(2*i-1)*30;
		beginy=300-(2*i-1)*30;
		for(var j=0;j<2*i-1;j++){
			this.posX.push(beginx)
				this.posY.push(beginy+j*60)
		}
		beginx=400-(2*i-1)*30;
		beginy=300+(2*i-1)*30;
		for(var j=0;j<2*i-1;j++){
			this.posX.push(beginx+j*60)
				this.posY.push(beginy)
		}
		beginx=400+(2*i-1)*30;
		beginy=300+(2*i-1)*30;
		for(var j=0;j<2*i-1;j++){
			this.posX.push(beginx)
				this.posY.push(beginy-j*60)
		}
		beginx=400+(2*i-1)*30;
		beginy=300-(2*i-1)*30;
		for(var j=0;j<2*i-1;j++){
			this.posX.push(beginx-j*60)
				this.posY.push(beginy)
		}

	}
	for(var i=0;i<10000;i++){
		this.ax.push(0);
		this.ay.push(0);
		this.vx.push(0);
		this.vy.push(0);
		this.r.push(0);
		this.g.push(0);
		this.b.push(0);
		this.alpha.push(1);
	}
	/*for (var i = 0; i < this.maxLoad; i++) {
			this.posX.push(randint(0, Math.floor(this.width / 40))*40);
			this.posY.push(randint(0, Math.floor(this.height / 40))*40);
			this.r.push(randint(0, 254));
			this.g.push(randint(0, 254));
			this.b.push(randint(0, 254));
			this.alpha.push(Math.random());
		}*/
	}
	
if (!window.Html5Test.testCaseList) {
	window.Html5Test.testCaseList = [];
}
window.Html5Test.testCaseList.push(basicTestCase);
